package com.xiaoyu.net.request;

import com.xiaoyu.net.queue.Priority;
import com.xiaoyu.net.queue.RequestJob;
import com.xiaoyu.net.queue.RequestQueue;

import in.srain.cube.request.RequestHandler;
import in.srain.cube.request.SimpleRequest;

public class QueuedSimpleRequest<T, OriginDataType> extends SimpleRequest<T, OriginDataType> {

    public QueuedSimpleRequest() {
        super();
    }

    public QueuedSimpleRequest(RequestHandler<T, OriginDataType> handler) {
        super(handler);
    }

    public RequestJob<T> enqueue() {
        return RequestQueue.getInstance().enqueueRequest(this, Priority.MEDIUM);
    }

    public RequestJob<T> enqueue(int priority) {
        return RequestQueue.getInstance().enqueueRequest(this, priority);
    }
}
